package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @author: liudehuan
 * @description
 * @date: 2023-04-23 16:28
 */
@RestController
@RequestMapping("/api/v1/channel")
public class ChannelController {

    @Autowired
    private IWemediaClient wemediaClient;

    @PostMapping("/list")
    public ResponseResult getChannelList(@RequestBody ChannelDto dto){
        System.out.println(wemediaClient);
        ResponseResult channelList = wemediaClient.getChannelList(dto);
        return channelList;
    }

    @PostMapping("/save")
    public ResponseResult saveChannel(@RequestBody WmChannel channel){
        return wemediaClient.saveChannel(channel);
    }

    @PostMapping("/update")
    public ResponseResult updateChannel(@RequestBody WmChannel channel){
        return wemediaClient.UpdateChannel(channel);
    }

    @GetMapping("/del/{id}")
    public ResponseResult deleteChannel(@PathVariable Integer id){
        return wemediaClient.deleteChannel(id);
    }
}
